package cn.szabadsag.order.controller;

import cn.szabadsag.order.domain.ProductOrder;
import cn.szabadsag.order.service.IProductOrderService;
import cn.szabadsag.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 服务订单
 *
 * @author yangcong
 * @date 2022年03月22日 14:15
 * @since v1.0
 */
@RestController
@RequestMapping("/productAdpot")
public class ProductOrderController {



    @Autowired
    private IProductOrderService productOrderService;


    /**
     * 根据id查询单个宠物信息
     * @param id
     * @return
     */
    @GetMapping("/loadById/{id}")
    public ProductOrder loadById(@PathVariable Long id){
        return productOrderService.loadById(id);
    }


    /**
     * 创建订单
     * @param map
     * @return
     */
    @PostMapping("/createOrder")
    public AjaxResult createOrder(@RequestBody Map<String,String> map, HttpServletRequest request){
        return productOrderService.createOrder(map, request);
    }

}
